package com.project;
import java.util.Scanner;


public class Test{
	public static void main(String args[]){
			Department dep[]=new Department[2];
			dep[0]=new Department(1001,"销售部","张三");
			dep[1]=new Department(1002,"技术部","王平");
			for(int i=0;i<2;i++){
				System.out.println(dep[i].toString());
			}
			
			Employee emp[]=new Employee[10];
			emp[0]=new Employee(11,"张一","女",new Date(1988,1,1),"销售部",new Date(2015,5,5));
			emp[1]=new Employee(12,"张二","男",new Date(1989,11,20),"销售部",new Date(2014,4,4));
			emp[2]=new Employee(13,"张三","男",new Date(1976,4,22),"销售部",new Date(2013,3,3));
			emp[3]=new Employee(14,"张思","女",new Date(1988,5,5),"销售部",new Date(2012,2,2));
			emp[4]=new Employee(15,"张五","女",new Date(1982,8,7),"销售部",new Date(2011,1,1));
			emp[5]=new Employee(21,"王一","男",new Date(1956,10,22),"技术部",new Date(2000,6,6));
			emp[6]=new Employee(22,"王炸","男",new Date(1978,4,2),"技术部",new Date(2001,7,7));
			emp[7]=new Employee(23,"王平","女",new Date(1990,3,5),"技术部",new Date(2008,8,8));
			emp[8]=new Employee(24,"王思","女",new Date(1970,2,3),"技术部",new Date(2005,9,9));
			emp[9]=new Employee(25,"王五","男",new Date(1980,2,1),"技术部",new Date(2006,10,10));
			for(int i=0;i<10;i++){
				System.out.println(emp[i].toString());
			}

			String inputjudge;
			do{
			System.out.print("请输入您要查询的信息：a.员工类	b.部门类");
			Scanner input=new Scanner(System.in);
			String input1=input.next();
			String a="a";	
			String b="b";
			int j=0;
			if(a.equals(input1)){
				System.out.print("\n请输入您已知的信息：a.员工编号	b.姓名");
				Scanner input2=new Scanner(System.in);
				String input3=input2.next();
				if(a.equals(input3)){
					System.out.print("\n请输入具体编号：");
					Scanner input4=new Scanner(System.in);
					int num=input4.nextInt();
					for(int i=0;i<10;i++){
						if(num==emp[i].getEmpno()){
							System.out.println("\n"+emp[i]);
							j=1;
						}
					}
					if(j==0){
						System.out.println("没有这个编号！");
					}
				}
				else if(b.equals(input3)){
					System.out.print("\n请输入具体姓名：");
					Scanner input4=new Scanner(System.in);
					String name=input4.next();
					for(int i=0;i<2;i++){
						if(name.equals(emp[i].getEmpno())){
							System.out.println("\n"+emp[i]);
							j=1;
						}
					}
					if(j==0){
						System.out.println("没有这个姓名！");
					}
				}
					
			}
			else if(b.equals(input1)){
				System.out.print("\n请输入您已知的信息：a.部门编号	b.部门名称");
				Scanner inputa=new Scanner(System.in);
				String inputb=inputa.next();
				if(a.equals(inputb)){
					System.out.print("\n请输入具体编号：");
					Scanner inputc=new Scanner(System.in);
					int num=inputc.nextInt();
					for(int i=0;i<2;i++){
						if(num==dep[i].getDepno()){
							System.out.println("\n"+dep[i]);
							j=1;
						}
					}
					if(j==0){
						System.out.println("没有这个部门编号！");
					}
				}
				else if(b.equals(inputb)){
					System.out.print("\n请输入具体部门名称：");
					Scanner inputc=new Scanner(System.in);
					String name=inputc.next();
					for(int i=0;i<2;i++){
						if(name.equals(dep[i].getDepno())){
							System.out.println("\n"+dep[i]);
							j=1;
						}
					}
					if(j==0){
						System.out.println("没有这个部门名称！");
					}
				}
			}
			System.out.println("请问您还要继续查询么？是请输入“y”，不是请输入“n”");
			Scanner inputj=new Scanner(System.in);
			inputjudge=inputj.next();
			}while(inputjudge.equals("y"));
	}
}